<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
    // 1.创建二个promise对象
    // 2. 使用promise.all获取二个promise对象存储的值

    var promiseObj1 = new Promise(function(resolve, reject) {
        setTimeout(function() {
            resolve({
                name: '张三',
                age: 18
            });
        }, 1000)
    })
    var promiseObj2 = new Promise(function(resolve, reject) {
        setTimeout(function() {
            resolve({
                name: '李四',
                age: 22
            });
        }, 3000)
    })

    // 参数是一个数组, 数组的成是promise对象,Promise.all也是promise对象
    Promise.all([promiseObj1, promiseObj2]).then(function(res) {
        console.log(res);
    }).catch(function(err) {
        console.log(err)
    });
</script>